'This is the actual usercontrol, where the user will
'set all the properties later used by MenuFrm.frm
'I have a german version of VB, and most of the code is
'generated, so it has the german comments... just ignore them
'they are for the ActiveX Wizard thing...
'My code is probably very messy & unorganized & unoptimized,
'but the menu is running pretty fast now, almost as fast as
'the windows menus when the mouse if moved over them.
'The code may seem a bit confusing at first, but you need
'to also look at the MenuFrm.frm code to understand it all.
'also the variables are kept in a puclic module (Module1.bas)
'so they can be accessed by the usercontrol and menufrm
Public Enum Style_Type
Etch_Style
OutDent_Style
PlainLine_Style
End Enum
Public Enum Sel_Type
Block
TextBlock
DottedTextBlock
End Enum
Private Type POINTAPI
X As Long
Y As Long
End Type
'Standard-Eigenschaftswerte:
Const m_def_MouseOverSelectionType = 0
Const m_def_LeftPicBackColor = &H8000000F
Const m_def_UseLeftImage = 0
Const m_def_MenuAnimSpeed = 500
Const m_def_OpenAnimated = 0
Const m_def_UseIcons = 0
Const m_def_ItemHotBackColor = &H8000000D
Const m_def_Style = 0
Const m_def_ItemForeColor = &H80000007
Const m_def_ItemHotForeColor = &H8000000E
'Ereignisdeklarationen:
Event ItemClicked(Index As Integer, Text As String, Name As String)
'api declarations
Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
'properties
Private m_ItemHotBackColor As OLE_COLOR
Private m_ItemForeColor As OLE_COLOR
Private m_ItemHotForeColor As OLE_COLOR
Private Sub UserControl_Resize()
'just make the usercontrol a little icon, invisible at runtime
UserControl.Width = 480
UserControl.Height = 480
End Sub
'ACHTUNG! DIE FOLGENDEN KOMMENTIERTEN ZEILEN NICHT ENTFERNEN ODER VER
NDERN!
'MappingInfo=UserControl,UserControl,-1,Font
Public Property Get Font() As Font
Attribute Font.VB_Description = "Returns a Font object."
Attribute Font.VB_UserMemId = -512
Set Font = UserControl.Font
End Property
Public Property Set Font(ByVal New_Font As Font)
Set UserControl.Font = New_Font
PropertyChanged "Font"
End Property
'ACHTUNG! DIE FOLGENDEN KOMMENTIERTEN ZEILEN NICHT ENTFERNEN ODER VER
NDERN!
'MappingInfo=UserControl,UserControl,-1,Enabled
Public Property Get Enabled() As Boolean
Attribute Enabled.VB_Description = "Returns/sets a value that determines whether an object can respond to user-generated events."
Enabled = UserControl.Enabled
End Property
Public Property Let Enabled(ByVal New_Enabled As Boolean)
UserControl.Enabled() = New_Enabled
PropertyChanged "Enabled"
End Property
'ACHTUNG! DIE FOLGENDEN KOMMENTIERTEN ZEILEN NICHT ENTFERNEN ODER VER
NDERN!
'MemberInfo=14
Public Function AddItem(Caption As String, Optional Name As String = "", Optional Enabled As Boolean = True, Optional ItemIcon As StdPicture, Optional ItemForeColor As OLE_COLOR = -1, Optional ItemHotForeColor As OLE_COLOR = -1, Optional ItemHotBackColor As OLE_COLOR = -1) As Boolean
'Add an item to the menu...
ItemCount = ItemCount + 1
ReDim Preserve Items(ItemCount)
Items(ItemCount).Text = Caption
'if it's a seperator disable it, so it is a seperator later